package com.qf.job;

import org.quartz.*;

import java.util.Date;

/**
 *
 * Quartz: 入门程序   执行任务
 * @author lixu
 */
public class HelloQuartzJob implements Job {
    /**
     * 执行的任务
     * @param jobExecutionContext
     * @throws JobExecutionException
     */
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        Scheduler scheduler = jobExecutionContext.getScheduler();
        try {
            String schedulerName = scheduler.getSchedulerName();
            Trigger trigger = jobExecutionContext.getTrigger();
            TriggerKey key = trigger.getKey();
           // key.getName() + key.getGroup()

            System.out.println("===="+key.getName()+"起床了=====时间：" + new Date() + ":调度器的名称：" + schedulerName);
        } catch (SchedulerException e) {
            e.printStackTrace();
        }



    }
}
